let pkgid = pkg.package_id().clone();
cx.compilation.libraries.entry(pkgid).or_insert(Vec::new())
.push((target.crate_name(), dst));
- if !target.is_lib() { continue }
+ }
+ if !target.is_lib() { continue }
- // Include immediate lib deps as well
- for dep in cx.dep_targets(pkg, target, profile).iter() {
- let (pkg, target, profile) = *dep;
- let pkgid = pkg.package_id();
- if !target.is_lib() { continue }
- if profile.doc { continue }
- if cx.compilation.libraries.contains_key(&pkgid) { continue }
-
- let v = try!(cx.target_filenames(target, profile));
- let v = v.into_iter().map(|f| {
- (target.crate_name(),
- cx.out_dir(pkg, Kind::Target, target).join(f))
- }).collect::<Vec<_>>();
- cx.compilation.libraries.insert(pkgid.clone(), v);
- }
+ // Include immediate lib deps as well
+ for dep in cx.dep_targets(pkg, target, profile).iter() {
+ let (pkg, target, profile) = *dep;
+ let pkgid = pkg.package_id();
+ if !target.is_lib() { continue }
+ if profile.doc { continue }
+ if cx.compilation.libraries.contains_key(&pkgid) { continue }
+
+ let v = try!(cx.target_filenames(target, profile));
+ let v = v.into_iter().map(|f| {
+ (target.crate_name(),
+ cx.out_dir(pkg, Kind::Target, target).join(f))
+ }).collect::<Vec<_>>();
+ cx.compilation.libraries.insert(pkgid.clone(), v);
}
}
}
assert_that(p.cargo_process("test").arg("-v"),
execs().with_status(0));
});
+
+test!(doctest_dev_dep {
+ let p = project("foo")
+ .file("Cargo.toml", r#"
+ [package]
+ name = "foo"
+ version = "0.0.1"
+ authors = []
+
+ [dev-dependencies]
+ b = { path = "b" }
+ "#)
+ .file("src/lib.rs", r#"
+ /// ```
+ /// extern crate b;
+ /// ```
+ pub fn foo() {}
+ "#)
+ .file("b/Cargo.toml", r#"
+ [package]
+ name = "b"
+ version = "0.0.1"
+ authors = []
+ "#)
+ .file("b/src/lib.rs", "");
+
+ assert_that(p.cargo_process("test").arg("-v"),
+ execs().with_status(0));
+});